import {requsetHttpData,requsetHttpCarousel,requsetHttpFloor} from '@/api'
//home   主页   小仓库

//保存
const state={
    //三级联动框 数据
    categoryList:[],
    //轮播图 图片
    CarouselList:[],
    //floor 数据
    FloorList:[]
}
//发送axios请求获取数据  但是这里不能修改页面
const actions={
    //请求三级联动
    async categoryList({commit}){
        let result=await requsetHttpData()
        if(result.code==200){
            commit('CATEGORULIST',result.data)
            
        }
    },
    //请求轮播图图片
    async CarouselList({commit}){
        let result = await requsetHttpCarousel()
        if(result.code===200){
            commit('CAROUSELLIST',result.data)
        }
    },
    //请求floor数据
    async FloorList({commit}){
        let result = await requsetHttpFloor()
        if(result.code===200){
            commit('FLOORLIST',result.data)
        }
    }
}
const mutations={
    CATEGORULIST(state,categoryList){
        state.categoryList=categoryList
    },
    CAROUSELLIST(state,CarouselList){
        state.CarouselList=CarouselList
    },
    FLOORLIST(state,FloorList){
        state.FloorList=FloorList
    }
}
const getters={}

export default {
    state,
    actions,
    mutations,
    getters
}